package com.itheima.youdianda.common;

/**
 * 基于ThreadLocal封装工具类，用户保存和获取当前登录用户id
 * threadLocal 保证前后公用一个线程
 */
public class BaseContext {

    public static ThreadLocal<Long> threadLocal = new ThreadLocal<>();

    public static void setCurrentId(Long empId){
        threadLocal.set(empId);
    }

    public static Long getCurrentId(){
         return threadLocal.get();
    }

}
